package com.goods.controller.business;

import com.goods.business.service.OutStockService;
import com.goods.common.model.business.OutStock;
import com.goods.common.response.ResponseBean;
import com.goods.common.utils.ListPageUtils;
import com.goods.common.vo.business.OutStockVO;
import com.goods.common.vo.system.PageVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/business/outStock")
public class OutStockController {
    @Autowired
    private OutStockService outStockService;

    @GetMapping("/findOutStockList")
    @ApiOperation("展示发放记录/搜索框查找发放列表")
    public ResponseBean findOutStockList(Integer pageSize,Integer pageNum,OutStockVO outStockVO){

        //
        List<OutStockVO> outStockList = outStockService.findOutStockList(pageNum,pageSize,outStockVO);
        if (!CollectionUtils.isEmpty(outStockList)){
            outStockList= ListPageUtils.page(outStockList, pageSize, pageNum);
        }

        PageVO<OutStockVO> outStockPageVO = new PageVO<>(outStockList.size(), outStockList);
        return ResponseBean.success(outStockPageVO);
    }


    @ApiOperation("发放详情")
    @GetMapping("/detail/{17}")
    public ResponseBean detail(){

        return ResponseBean.success();
    }

}
